<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>“安装通”平台数据周报</title>
    <style>
        div.dataBlc>div{
            padding: 0px 7px;
        }
        div.dataBlc>div div{
            height: 118px;
            background: url("/res/img/back/dataBlc_03.jpg") right bottom no-repeat;
            color: white;
            padding: 0px;
            background-size: cover;
            padding-left: 10px;
            margin-bottom: 15px;
            border-radius:3px;
        }
        div.dataBlc>div h2{
            font-size: 24px;
            margin: 0px;
            padding-top: 25px;
        }
        div.dataBlc>div h2>small{
            color: white;
        }
        div.dataBlc>div h2>span>small{
            color: white;
        }
        div.dataBlc>div h6{
            margin: 0px;
        }
        .form-group .btn {
             margin-bottom: 5px;
        }
        .x_title h2 {
            margin-top: 10px;
        }
        .right {
            text-align: right;
        }
        .loading {
            background:url(/res/images/loading5.gif) no-repeat center;
        }
    </style>
  </head>

  <body>
        <!-- page content -->
        <div class="row">
          <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="x_title form-group">
                    <h2>“安装通”平台数据周报</h2>
                    <div style="overflow: hidden;display: inline-block;margin-left: 20px;">
                        <div class="controls input-append date form_date addCDate" data-date="" data-date-format="dd MM"
                             data-link-field="addCDate1" data-link-format="yyyy-mm-dd" style="width: 115px;">
                            <span class="add-on"><i class="icon-th"></i></span>
                            <input id="addCDateHM1" size="16" type="text" value="" readonly  style="width: 80px;">
                        </div>
                        —
                        <input type="hidden" id="addCDate1" value=""/>
                        <div class="controls input-append date form_date addCDate" data-date="" data-date-format="dd MM"
                             data-link-field="addCDate2" data-link-format="yyyy-mm-dd" style="width: 115px;">
                            <span class="add-on"><i class="icon-th"></i></span>
                            <input id="addCDateHM2" size="16" type="text" value="" readonly style="width: 80px;">
                        </div>
                        &nbsp;&nbsp;
                        <input type="hidden" id="addCDate2" value=""/>
                        <button type="button" onclick="search();" class="btn btn-primary">搜索</button>
                        <button type="submit" id="outexcel" onclick="exportExcel();" class="btn btn-success">导出EXCEL</button>
                        <label>说明：“年度累计发生数”根据输入的查询结束时间的年度确定</label>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content" >
                    <table class="table table-bordered  table-condensed">
                        <thead>
                            <tr>
                                <th colspan="4" style="font-size: 20px;">“安装通”平台数据周报</th>
                            </tr>
                            <tr>
                                <th colspan="3" class="right">数据周期：</th>
                                <th width="25%" class="cycleShow" >--</th>
                            </tr>
                            <tr>
                                <th colspan="4" class="active">交易情况-询价单</th>
                            </tr>
                            <tr>
                                <th width="25%" >指标</th>
                                <th width="25%" >数量</th>
                                <th width="25%" >金额</th>
                                <th width="25%" >客单价</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>历史累计发生数</td>
                                <td class="contentTd" id="quoteNumTotal">--</td>
                                <td class="contentTd" id="sumQuoteTotal">--</td>
                                <td class="contentTd" id="kdjTotal">--</td>
                            </tr>
                            <tr>
                                <td><label class="year"></label>年累计发生数</td>
                                <td class="contentTd" id="quoteNumYear">--</td>
                                <td class="contentTd" id="sumQuoteYear">--</td>
                                <td class="contentTd" id="kdjYear">--</td>
                            </tr>
                            <tr>
                                <td>本周期累计发生数</td>
                                <td class="contentTd" id="quoteNumWeek">--</td>
                                <td class="contentTd" id="sumQuoteWeek">--</td>
                                <td class="contentTd" id="kdjWeek">--</td>
                            </tr>
                        </tbody>
                        <thead>
                            <tr>
                                <th colspan="4" class="active">其中订单</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>历史累计发生数</td>
                                <td class="contentTd" id="orderNumTotal">--</td>
                                <td class="contentTd" id="totalPriceTotal">--</td>
                                <td class="contentTd" id="kdjOrderTotal">--</td>
                            </tr>
                            <tr>
                                <td><label class="year"></label>年累计发生数</td>
                                <td class="contentTd" id="orderNumYear">--</td>
                                <td class="contentTd" id="totalPriceYear">--</td>
                                <td class="contentTd" id="kdjOrderYear">--</td>
                            </tr>
                            <tr>
                                <td>本周期累计发生数</td>
                                <td class="contentTd" id="orderNumWeek">--</td>
                                <td class="contentTd" id="totalPriceWeek">--</td>
                                <td class="contentTd" id="kdjOrderWeek">--</td>
                            </tr>
                        </tbody>
                        <thead>
                            <tr>
                                <th colspan="4" class="active">其中自营流水</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>历史累计发生数</td>
                                <td class="contentTd" id="selfOrderNumTotal">--</td>
                                <td class="contentTd" id="selfTotalPriceTotal">--</td>
                                <td class="contentTd" id="kdjSelfOrderTotal">--</td>
                            </tr>
                            <tr>
                                <td><label class="year"></label>年累计发生数</td>
                                <td class="contentTd" id="selfOrderNumYear">--</td>
                                <td class="contentTd" id="selfTotalPriceYear">--</td>
                                <td class="contentTd" id="kdjSelfOrderYear">--</td>
                            </tr>
                            <tr>
                                <td>本周期累计发生数</td>
                                <td class="contentTd" id="selfOrderNumWeek">--</td>
                                <td class="contentTd" id="selfTotalPriceWeek">--</td>
                                <td class="contentTd" id="kdjSelfOrderWeek">--</td>
                            </tr>
                        </tbody>
                    </table>
                    <table class="table table-bordered  table-condensed">
                        <thead>
                            <tr>
                                <th colspan="5" class="active">会员情况</th>
                            </tr>
                            <tr>
                                <th width="20%" >指标</th>
                                <th width="20%" >入驻采购商数</th>
                                <th width="20%" >入驻供应商数</th>
                                <th width="20%" >深度会员数</th>
                                <th width="20%" >深度会员收入金额</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>历史累计发生数</td>
                                <td class="contentTd" id="purcharserTotal">--</td>
                                <td class="contentTd" id="providerTotal">--</td>
                                <td class="contentTd" id="totalVip">--</td>
                                <td>--</td>
                            </tr>
                            <tr>
                                <td><label class="year"></label>年累计发生数</td>
                                <td class="contentTd" id="purcharserYear">--</td>
                                <td class="contentTd" id="providerYear">--</td>
                                <td class="contentTd" id="yearVip">--</td>
                                <td>--</td>
                            </tr>
                            <tr>
                                <td>本周期累计发生数</td>
                                <td class="contentTd" id="purcharserWeek">--</td>
                                <td class="contentTd" id="providerWeek">--</td>
                                <td class="contentTd" id="weekVip">--</td>
                                <td>--</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- Custom Theme Scripts -->
        <!--<script type="text/javascript" src="/res/build/js/common/common.js"></script>-->
        <script src="/res/layer/layer.js"></script>
        <!--<script type="text/javascript" src="/res/build/js/weekReport.js"></script>-->
  <script type="text/javascript">
      $(function () {
          $('.form_date').datetimepicker({
              language: 'cn',
              format: 'yyyy-mm-dd',
              weekStart: 1,
              todayBtn: 1,
              autoclose: 1,
              todayHighlight: 1,
              startView: 2, //这里就设置了默认视图为年视图
              minView: 2, //设置最小视图为年视图
              endDate: new Date(),
              forceParse: 0
          });

      });

      function $msg(msg, time) {
          layer.msg(msg || '', {time: time || 1000});
      }

      function search() {

          var st = $("#addCDate1").val();
          var et = $("#addCDate2").val();

          if(st == ''){
              $msg("请选择周期开始时间");
              return false;
          }
          if(et == ''){
              $msg("请选择周期结束时间");
              return false;
          }
          $(".cycleShow").text(st + " 至 " + et);
          $(".contentTd").each(function (i) {
              $(this).text("");
              $(this).addClass("loading");
          });

          var year = new Date($("#addCDate2").val()).getFullYear();
          $(".year").text(year);
          $.getJSON('/weekReport/reportData', {st: st, et: et,year:year}, function (data) {
              $.each(data, function (key, values) {
                  $("#" + key).removeClass("loading");
                  $("#" + key).text(key.indexOf('kdj') > -1 ? (values.toFixed(2)) : values);
              });
          });
      }

      function exportExcel (){

          var st = $("#addCDate1").val();
          var et = $("#addCDate2").val();

          if(st == ''){
              $msg("请选择周期开始时间");
              return false;
          }
          if(et == ''){
              $msg("请选择周期结束时间");
              return false;
          }
          var year = new Date($("#addCDate2").val()).getFullYear();
          location.href = '/weekReport/export?st=' + st + "&et=" + et + "&year=" + year;
      }


  </script>
  </body>
</html>
